import {Component, OnDestroy, OnInit} from '@angular/core';
import {TipService} from 'itcloud-plugin';
import {DemoInterface} from '../../common/interface/demo.interface';

@Component({
    moduleId: module.id,
    templateUrl: './demo.detail.component.html',
    styleUrls: ['./demo.detail.component.css']
})

export class DemoDetailComponent implements OnInit, OnDestroy {

    title = 'Hello demo html!';

    constructor(private tipService: TipService,
                private demoInterface: DemoInterface) {
    }

    ngOnInit() {
        const a = 1;
        let temp: string;
        temp = 'xxx';
        this.title += temp;
        setTimeout(() => {
            this.test();
        }, 5000);

        this.getData();
    }

    ngOnDestroy() {
    }

    getData() {
        // 请求后台数据
        this.demoInterface.getDemoDataByGet({}).subscribe(res => {

        }, err => {

        });
    }

    test() {
        this.title += 'yyy';
        this.tipService.show({
            type: 'error',
            title: 'System error.'
        });
    }
}
